package br.com.simulador.session;

import br.com.simulador.model.*;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("itemQuestaoHome")
public class ItemQuestaoHome extends EntityHome<ItemQuestao> {

	@In(create = true)
	QuestaoHome questaoHome;

	public void setItemQuestaoId(Long id) {
		setId(id);
	}

	public Long getItemQuestaoId() {
		return (Long) getId();
	}

	@Override
	protected ItemQuestao createInstance() {
		ItemQuestao itemQuestao = new ItemQuestao();
		return itemQuestao;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
		Questao questao = questaoHome.getDefinedInstance();
		if (questao != null) {
			getInstance().setQuestao(questao);
		}
	}

	public boolean isWired() {
		return true;
	}

	public ItemQuestao getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

}
